#ifndef __DATABASE_H__
#define __DATABASE_H__

#define CORRELATION_PARAMS          4
#define CORRELATION_DATA_PARAMS     10
#define EXCHANGE_PARAMS             2
#define STOCK_PARAMS                3
#define STOCK_DATA_PARAMS           8
//#define STOCK_STATS_PARAMS          4

// this should probably be done a little smarter..
#define MAX_PARAMS                  10

// DO NOT CHANGE THIS ORDER
typedef enum
{
    TABLE_CORRELATION,
    TABLE_CORRELATION_DATA,
    TABLE_EXCHANGE,
    TABLE_STOCK,
    TABLE_STOCK_DATA,
    //TABLE_STOCK_STATS,
    NUM_TABLES // should work if no values are ever assigned
}TableID;

// assumes this order of tableIDs
static const char* const TableNames[] = 
{
    "correlation",
    "correlation_data",
    "exchange",
    "stock",
    "stock_data",
    "stock_stats"
};

static const char* const TableAttributes[NUM_TABLES][MAX_PARAMS] =
{
    {"id", "name", "description", "function"},
    {"symbol_1", "symbol_2", "correlation_id", "value", "sum_of_products", "length", "stock_1_sum", "stock_2_sum", "stock_1_sum_of_squares","stock_2_sum_of_squares"},
    {"id", "name"},
    {"symbol", "exchange_id", "name"},
    {"symbol", "date", "open", "high", "low", "close", "volume", "adj_close"},
    //{"symbol", "correlation_length", "sum", "sum_of_squares"}
};

typedef enum
{
    CORRELATION_PARAM_ID,
    CORRELATION_PARAM_NAME,
    CORRELATION_PARAM_DESCRIPTION,
    CORRELATION_PARAM_FUNCTION
}CorrelationParameters;

typedef enum
{
    CORRELATION_DATA_PARAM_SYMBOL_1,
    CORRELATION_DATA_PARAM_SYMBOL_2,
    CORRELATION_DATA_PARAM_CORRELATION_ID,
    CORRELATION_DATA_PARAM_VALUE,
    CORRELATION_DATA_PARAM_SUM_OF_PRODUCTS,
    CORRELATION_DATA_PARAM_LENGTH,
    CORRELATION_DATA_PARAM_STOCK_1_SUM,
    CORRELATION_DATA_PARAM_STOCK_2_SUM,
    CORRELATION_DATA_PARAM_STOCK_1_SUM_OF_SQUARES,
    CORRELATION_DATA_PARAM_STOCK_2_SUM_OF_SQUARES,
}CorrelationDataParameters;

typedef enum
{
    EXCHANGE_PARAM_ID,
    EXCHANGE_PARAM_NAME
}ExchangeParameters;

typedef enum
{
    STOCK_PARAM_SYMBOL,
    STOCK_PARAM_EXCHANGE_ID,
    STOCK_PARAM_NAME
}StockParameters;

typedef enum
{
    STOCK_DATA_PARAM_SYMBOL,
    STOCK_DATA_PARAM_DATE,
    STOCK_DATA_PARAM_OPEN,
    STOCK_DATA_PARAM_HIGH,
    STOCK_DATA_PARAM_LOW,
    STOCK_DATA_PARAM_CLOSE,
    STOCK_DATA_PARAM_VOLUME,
    STOCK_DATA_PARAM_ADJ_CLOSE
}StockDataParameters;

typedef enum
{
    STOCK_STATS_PARAM_SYMBOL,
    STOCK_STATS_PARAM_CORRELATION_LENGTH,
    STOCK_STATS_PARAM_SUM,
    STOCK_STATS_PARAM_SUM_OF_SQUARES,
}StockStatsParameters;

/*
typedef enum
{
    INDEFINITE
}CorrelationID;*/

int getNumParams(TableID id);

#endif
